# 作者: YYJ
# 2025年07月11日20时38分49秒
# 2486249622@qq.com
import os
import time
from multiprocessing import Process

nums = [11, 12] # 每个进程的内存空间相互独立，互不干扰
def work1():
    print("子进程1 pid=%s 启动, nums=%s" % (os.getpid(), nums))
    for i in range(3):
        nums.append(i)
        time.sleep(1)
        print("子进程1 nums=%s" % nums)

if __name__ == '__main__':
    p1 = Process(target=work1)
    p1.start()
    p1.join()
    print("主进程 nums=%s" % nums)